/*
2021-8-8
https://www.acwing.com/problem/content/1292/
*/ 
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
typedef long long ll;
const int mod=100003;

ll qpow(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}

int main()
{
    ll n,m;
    cin>>m>>n;
    
    cout<<(qpow(m,n)-m*qpow(m-1,n-1)%mod+mod)%mod<<endl;
    
    return 0;
}
